load("//bazel:skia_rules.bzl", "skia_cc_library", "skia_objc_library")

package(
    default_applicable_licenses = ["//:license"],
)

licenses(["notice"])

skia_objc_library(
    name = "audioplayer_mac",
    hdrs = ["SkAudioPlayer.h"],
    features = ["layering_check"],
    non_arc_srcs = ["SkAudioPlayer_mac.mm"],
    sdk_frameworks = ["AVFoundation"],
    deps = ["//:core"],
)

skia_cc_library(
    name = "audioplayer",
    srcs = [
        "SkAudioPlayer.cpp",
    ] + select({
        # TODO(fmalita): support platform-specific audio libs
        # "@platforms//os:android": ["SkAudioPlayer_oboe.cpp"],
        # "@platforms//os:linux": ["SkAudioPlayer_sfml.cpp"],
        "@platforms//os:macos": [],
        "//conditions:default": ["SkAudioPlayer_none.cpp"],
    }),
    hdrs = ["SkAudioPlayer.h"],
    features = ["layering_check"],
    visibility = ["//tools/viewer:__pkg__"],
    deps = [
        "//:core",
    ] + select({
        "@platforms//os:macos": [":audioplayer_mac"],
        "//conditions:default": [],
    }),
)
